package com.youth;

import com.youth.config.AccessFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.cloud.netflix.zuul.filters.ZuulProperties;
import org.springframework.context.annotation.Bean;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @ClassName ZuulService8003Application
 * @Description: TODO 8003zuul服务启动类
 * @Author oops
 * @Date 2019/10/18 9:45
 **/
@SpringBootApplication
@EnableEurekaClient
@EnableZuulProxy
@EnableSwagger2
public class ZuulService8003Application {
    public static void main(String[] args) {
        SpringApplication.run(ZuulService8003Application.class, args);
    }

    //    zuul配置，使得zuul能够使用config实时刷新
    @RefreshScope
    @ConfigurationProperties("zuul")
    public ZuulProperties zuulProperties() {
        return new ZuulProperties();
    }

    @Bean
    public AccessFilter accessFilter() {
        return new AccessFilter();
    }
}
